/**
 *  *2010-5-19 上午10:56:27  add 
 */
package com.base.myproject.client.HR.setting;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.base.myproject.client.HR.Salary.SelectGrid;
import com.base.myproject.client.HR.bcode.HrBcodeSelectButton;
import com.base.myproject.client.busi.BaseStore;
import com.base.myproject.client.busi.BO.BusiObject;
import com.base.myproject.client.busi.BO.TreeNodeModelData;
import com.base.myproject.client.jdbc.DataSet;
import com.base.myproject.client.jdbc.StoreInfo;
import com.base.myproject.client.system.Env;
import com.base.myproject.client.ui.BaseBusiLeftPanel;
import com.base.myproject.client.ui.BaseFormPanel;
import com.base.myproject.client.ui.BaseGridPanel;
import com.base.myproject.client.ui.BaseJDBCPanel;
import com.base.myproject.client.ui.celleditor.BaseComboBoxForm;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.Style.SelectionMode;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.TableData;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel.CheckNodes;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

/**
 * 
 * 税务设置表
 * @author Administrator 2010-5-19 javazgw@gmail.com
 */
public class HrTaxSeting extends BaseJDBCPanel {
	BaseStore<BusiObject> mstore = null;
	NumberFormat nf = NumberFormat.getFormat("#,##0%");
	HrBcodeSelectButton hrbsb ;
	HrBcodeSelectButton hrbsb_lw ;
	ColumnConfig systembcodecolumn ;
	ColumnConfig systembcodecolumn_lw;

	public HrTaxSeting() {
		initrenderer();	
		init();
		registerMainStore(mstore);
		registerStore(mstore);
	}

	public void init() {
		this.add(initWeigetx());
		
	}

	private void setdefault() {
		mstore.addDefault("bcode", Env.getEnvbcode());
	}

	public void complete() {
		super.complete();
	}

	private Widget initWeigetx() {
		VerticalPanel v = new VerticalPanel();
		HorizontalPanel h= new HorizontalPanel();
		v.setHorizontalAlign(HorizontalAlignment.LEFT);
		v.setSpacing(1);
		h.setVerticalAlign(VerticalAlignment.TOP);
		h.add(CreateCcodeLeftPanel());
		v.add(createForm());
		v.add(createGrid());
		initSelectGrid();
		
		TabPanel panel = new TabPanel();
		panel.setPlain(true);
		panel.setSize(730, 160);
		
		TabItem zz_tab = new TabItem("组织");
		zz_tab.add(createBcodeGrid());
		hrbsb = new HrBcodeSelectButton(){
			public void doposted(List<TreeNodeModelData> modeldatalist) {
				for(TreeNodeModelData tnmd : modeldatalist){
					HashMap hm = new HashMap();
					hm.put("systembcode", tnmd.get("systembcode"));
					hm.put("sheetcode", "HrTaxSet");//这里是针对每个类用到组织条件的时候 添加进去类名  用于区分
					this.getTarget_store().add(hm);
				}
			}
		};
		hrbsb.setCheckNodes(CheckNodes.BOTH);
		hrbsb.setNeesreselect(true);
		hrbsb.setTarget_store(bcode_store);
		zz_tab.setAutoHeight(true);
		panel.add(zz_tab);
		
		TabItem zy_tab = new TabItem("职级");
		zy_tab.addStyleName("pad-text");
		zy_tab.add(zy_Grid);
		panel.add(zy_tab);
		
		TabItem ji_neng = new TabItem("雇佣组别");// hr_jobgroup
		ji_neng.addStyleName("pad-text");
		ji_neng.add(jobgroup_Grid);
		panel.add(ji_neng);

		TabItem z_j = new TabItem("雇佣性质"); // hr_jobproperty
		z_j.addStyleName("pad-text");
		z_j.add(jobproperty_Grid);
		panel.add(z_j);

		TabItem lb_tab = new TabItem("雇佣类别"); // hr_jobtype
		lb_tab.addStyleName("pad-text");
		lb_tab.add(jobtype_Grid);
		panel.add(lb_tab);

		TabItem zyzk_tab = new TabItem("雇佣状况"); // hr_jobtype
		zyzk_tab.addStyleName("pad-text");
		zyzk_tab.add(zyzk_Grid);
		panel.add(zyzk_tab);
		
		TabItem zyzk_hjq = new TabItem("户籍区"); // hr_jobtype
		zyzk_hjq.addStyleName("pad-text");
		zyzk_hjq.add(hjq_Grid);
		panel.add(zyzk_hjq);
		
		TabItem zyzk_cx = new TabItem("城/乡"); // hr_jobtype
		zyzk_cx.addStyleName("pad-text");
		zyzk_cx.add(cx_Grid);
		panel.add(zyzk_cx);
		
		TabItem lw_tab = new TabItem("例外");
		lw_tab.add(createlwGrid());
		hrbsb_lw = new HrBcodeSelectButton(){
			public void doposted(List<TreeNodeModelData> modeldatalist) {
				for(TreeNodeModelData tnmd : modeldatalist){
					HashMap hm = new HashMap();
					hm.put("systembcode", tnmd.get("systembcode"));
					hm.put("sheetcode", "HrTaxSet");
					this.getTarget_store().add(hm);
				}
			}
		};
		hrbsb_lw.setCheckNodes(CheckNodes.BOTH);
		hrbsb_lw.setNeesreselect(true);
		hrbsb_lw.setTarget_store(lw_store);
		lw_tab.setAutoHeight(true);
		lw_tab.setAutoHeight(true);
		panel.add(lw_tab);
		
		v.add(panel);
		
		h.add(v);
		h.setSpacing(2);
		return h;
	}
	
	SelectGrid zy_Grid;
	SelectGrid jobgroup_Grid;
	SelectGrid jobproperty_Grid;
	SelectGrid jobtype_Grid;
	SelectGrid zyzk_Grid;
	SelectGrid hjq_Grid;
	SelectGrid  cx_Grid;
	
	public void initSelectGrid() {
		//职级
		zy_Grid = new SelectGrid(
				mstore,
				"hr_range_zy_c",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'zy' ) as a left join  (select code,isset,upcode from hr_range_zy_c where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");	
		// 雇佣组别
		jobgroup_Grid = new SelectGrid(
				mstore,
				"hr_range_jobgroup",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobgroup' ) as a left join  (select code,isset,upcode from hr_range_jobgroup where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");
		// 雇佣性质
		jobproperty_Grid = new SelectGrid(
				mstore,
				"hr_range_jobproperty",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobproperty' ) as a left join  (select code,isset,upcode from hr_range_jobproperty where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");
		// 雇佣类别
		jobtype_Grid = new SelectGrid(
				mstore,
				"hr_range_jobtype",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_jobtype' ) as a left join  (select code,isset,upcode from hr_range_jobtype where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");
		// 雇佣状况
		zyzk_Grid = new SelectGrid(
				mstore,
				"hr_range_zyzk",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'zyzk' ) as a left join  (select code,isset,upcode from hr_range_zyzk where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");
		
		//户籍区
		hjq_Grid = new SelectGrid(
				mstore,
				"hr_range_hjq",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_a' ) as a left join  (select code,isset,upcode from hr_range_hjq where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");
		//城乡
		cx_Grid = new SelectGrid(
				mstore,
				"hr_range_cx",
				"select a.code,a.name,isnull(b.isset,0) as isset,upcode from ( select code,name  from dictionary where type = 'hr_cz' ) as a left join  (select code,isset,upcode from hr_range_cx where upcode = '{icode}' and sheetcode='HrTaxSet') as b on a.code = b.code",
				"icode","HrTaxSet");
		
		zy_Grid.grid.setHeight(125);
		jobgroup_Grid.grid.setHeight(125);
		jobproperty_Grid.grid.setHeight(125);
		jobtype_Grid.grid.setHeight(125);
		zyzk_Grid.grid.setHeight(125);
		hjq_Grid.grid.setHeight(125);
		cx_Grid.grid.setHeight(125);
		zy_Grid.setBorders(false);
		jobgroup_Grid.setBorders(false);
		jobproperty_Grid.setBorders(false);
		jobtype_Grid.setBorders(false);
		zyzk_Grid.setBorders(false);
		hjq_Grid.setBorders(false);
		cx_Grid.setBorders(false);

	}
	
	BaseStore<BusiObject> bcode_store = null;
	BaseStore<BusiObject> getBcodeStore() {
		if (bcode_store == null) {
			createBcodeStore();
		}
		return bcode_store;
	}
	BaseStore<BusiObject> createBcodeStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("systembcode");
		type.getField("systembcode").setType(String.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_range_bcode");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_range_bcode where sheetcode='HrTaxSet' and upcode ='{icode}'");
	    info.setParent(mstore);// 关联主表
		info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		info.setLinkparent_chile_columns(new String[] { "upcode" });//
		bcode_store = new BaseStore<BusiObject>(type, info);
		return bcode_store;
	}
	
	BaseComboBoxForm<BaseModelData> render = new BaseComboBoxForm<BaseModelData>("id", "name",
			"systeminfo",
			"", true);
	BaseGridPanel bcodegrid = null;
	BaseGridPanel createBcodeGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		systembcodecolumn = new ColumnConfig("systembcode", "部门人员", 80);
		systembcodecolumn.setRenderer(render);
		columns.add(systembcodecolumn);
		ColumnModel cm = new ColumnModel(columns);
		bcodegrid = new BaseGridPanel(getBcodeStore(), cm, true, true)
		{
			protected void addnewrecord() {
				addrecord();
			}
		};
		cbs.setSelectionMode(SelectionMode.SINGLE);
		bcodegrid.getBg().setSelectionModel(cbs);
		bcodegrid.getBg().setHeight(110);
		bcodegrid.getBg().setBorders(false);
		return bcodegrid;
	}	
	void addrecord() {
		hrbsb.showEditor();
	}	
	
	//例外的grid
	
	BaseStore<BusiObject> lw_store = null;
	BaseStore<BusiObject> getlwStore() {
		if (lw_store == null) {
			createlwStore();
		}
		return lw_store;
	}
	BaseStore<BusiObject> createlwStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("systembcode");
		type.getField("systembcode").setType(String.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_range_lw");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_range_lw where sheetcode='HrTaxSet' and upcode ='{icode}'");
		info.setParent(mstore);// 关联主表
		info.setLinkparentcolumns(new String[] { "icode" }); // 关联主表字段
		info.setLinkparent_chile_columns(new String[] { "upcode" });//
		lw_store = new BaseStore<BusiObject>(type, info);
		return lw_store;
	}
	
	BaseGridPanel lwgrid = null;
	BaseGridPanel createlwGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());
		systembcodecolumn_lw = new ColumnConfig("systembcode", "部门人员", 80);
		systembcodecolumn_lw.setRenderer(render);
		columns.add(systembcodecolumn_lw);
		ColumnModel cm = new ColumnModel(columns);
		lwgrid = new BaseGridPanel(getlwStore(), cm, true, true)
		{
			protected void addnewrecord() {
				addlwrecord();
			}
		};
		cbs.setSelectionMode(SelectionMode.SINGLE);
		lwgrid.getBg().setSelectionModel(cbs);
		lwgrid.getBg().setHeight(110);
		lwgrid.getBg().setBorders(false);
		return lwgrid;
	}	

	public void addlwrecord() {
		hrbsb_lw.showEditor();
	}

	public ContentPanel CreateCcodeLeftPanel() {
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		ColumnConfig cname = new ColumnConfig("code", "单号", 200);
		TextField<String> gnametext = new TextField<String>();

		columns.add(cname);

		ColumnModel cm = new ColumnModel(columns);

		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("code");
		type.getField("code").setType(String.class);
		type.addField("desc_en");
		type.getField("desc_en").setType(String.class);
		type.addField("desc_cn");
		type.getField("desc_cn").setType(String.class);
		type.addField("taxfree");
		type.getField("taxfree").setType(Double.class);
		type.addField("vprepare");
		type.getField("vprepare").setType(String.class);
		type.addField("modifydate");
		type.getField("modifydate").setType(Date.class);
		type.addField("createdate");
		type.getField("createdate").setType(Date.class);
		
		type.addField("effectstartdate");
		type.getField("effectstartdate").setType(Date.class);
		type.addField("effectenddate");
		type.getField("effectenddate").setType(Date.class);
		
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_tax");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_tax");

		BaseBusiLeftPanel<BusiObject> basbusileftpanel = new BaseBusiLeftPanel<BusiObject>(
				columns, type, info);
		mstore = basbusileftpanel.getStore();
		basbusileftpanel.getGrid().setWidth("260");
		setMaincomponent(basbusileftpanel.getGrid());
		return basbusileftpanel.getPanel();
	}

	BaseFormPanel form = null;

	BaseFormPanel createForm() {
		BaseFormPanel form = new BaseFormPanel(mstore);
		form.setWidth(730);
		TableLayout tl = new TableLayout(6);

		TableData td = new TableData();
		td.setRowspan(1);
		td.setHorizontalAlign(HorizontalAlignment.LEFT);
		td.setVerticalAlign(VerticalAlignment.TOP);
		td.setPadding(2);
		form.setLayout(tl);
		form.setHeaderVisible(false);

		form.add(new Label("设置编号:"), td);
		TextField<String> C_num2 = new TextField<String>();
		C_num2.setName("code");
		form.add(C_num2, td);
		form.add(new Label("描述:"), td);
		TextField<String> C_num3 = new TextField<String>();
		C_num3.setName("desc_en");
		form.add(C_num3, td);
		form.add(new Label("desc_cn:"), td);
		TextField<String> C_num4 = new TextField<String>();
		C_num4.setName("desc_cn");
		form.add(C_num4, td);
		
		
		
		form.add(new Label("有效期从:"), td);
		DateField C_data10 = new DateField();
		C_data10.getPropertyEditor().setFormat(
				DateTimeFormat.getFormat("yyyy-M-d"));
		C_data10.setName("effectstartdate");
		form.add(C_data10, td);
		
		
		form.add(new Label("有效期到:"), td);
		DateField C_data11 = new DateField();
		C_data11.getPropertyEditor().setFormat(
				DateTimeFormat.getFormat("yyyy-M-d"));
		C_data11.setName("effectenddate");
		form.add(C_data11, td);
		
		
		
		form.add(new Label("免税金额:"), td);
		NumberField C_num5 = new NumberField();
		C_num5.setPropertyEditorType(Double.class);
		C_num5.setName("taxfree");
		form.add(C_num5, td);
		form.add(new Label("制单人:"), td);
		TextField<String> C_num6 = new TextField<String>();
		C_num6.setName("vprepare");
		form.add(C_num6, td);
		form.add(new Label("最近修改日期:"), td);
		DateField C_data7 = new DateField();
		C_data7.getPropertyEditor().setFormat(
				DateTimeFormat.getFormat("yyyy-M-d"));
		C_data7.setName("modifydate");
		form.add(C_data7, td);
		form.add(new Label("建立日期:"), td);
		
		DateField C_data8 = new DateField();
		C_data8.getPropertyEditor().setFormat(
				DateTimeFormat.getFormat("yyyy-M-d"));
		C_data8.setName("createdate");
		form.add(C_data8, td);
		form.inited();
		return form;
	};

	BaseStore<BusiObject> detailstore = null;

	BaseStore<BusiObject> getStore() {
		if (detailstore == null) {
			createStore();
		}
		return detailstore;
	}

	BaseStore<BusiObject> createStore() {
		ModelType type = new ModelType();
		type.setRoot("records");
		type.setRecordName("record");
		type.setTotalName("totle");
		type.addField("icode");
		type.getField("icode").setType(Long.class);
		type.addField("upcode");
		type.getField("upcode").setType(String.class);
		type.addField("amountstart");
		type.getField("amountstart").setType(Double.class);
		type.addField("amountend");
		type.getField("amountend").setType(Double.class);
		type.addField("tax");
		type.getField("tax").setType(Double.class);
		type.addField("netnum");
		type.getField("netnum").setType(Double.class);
		StoreInfo info = new StoreInfo();
		info.setTablename("hr_taxdetail");
		info.setKeyname(new String[] { "icode" });
		info.setSql("select * from hr_taxdetail where upcode = '{code}'");
		info.setParent(mstore);// 关联主表
		info.setLinkparentcolumns(new String[] { "code" }); // 关联主表字段
		info.setLinkparent_chile_columns(new String[] { "upcode" });// 关联主表字段
		detailstore = new BaseStore<BusiObject>(type, info);
		return detailstore;
	}

	BaseGridPanel gridpanel = null;

	BaseGridPanel createGrid() {
		CheckBoxSelectionModel cbs = new CheckBoxSelectionModel();
		List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
		columns.add(cbs.getColumn());

		ColumnConfig C3 = new ColumnConfig("amountstart", "起薪", 80);
		NumberField C_num3 = new NumberField();
		C_num3.setPropertyEditorType(Double.class);
		C3.setEditor(new CellEditor(C_num3));
		columns.add(C3);
		ColumnConfig C4 = new ColumnConfig("amountend", "到", 80);
		NumberField C_num4 = new NumberField();
		C_num4.setPropertyEditorType(Double.class);
		C4.setEditor(new CellEditor(C_num4));
		columns.add(C4);
		ColumnConfig C5 = new ColumnConfig("tax", "税率", 80);
		C5.setNumberFormat(nf);
		NumberField C_num5 = new NumberField();
		C_num5.setPropertyEditorType(Double.class);
		C5.setEditor(new CellEditor(C_num5));
		columns.add(C5);
		ColumnConfig C6 = new ColumnConfig("netnum", "减数", 80);
		NumberField C_num6 = new NumberField();
		C_num6.setPropertyEditorType(Double.class);
		C6.setEditor(new CellEditor(C_num6));
		columns.add(C6);

		ColumnModel cm = new ColumnModel(columns);
		gridpanel = new BaseGridPanel(getStore(), cm, true, true);
		cbs.setSelectionMode(SelectionMode.SINGLE);
		gridpanel.getBg().setSelectionModel(cbs);
		gridpanel.getBg().setHeight(198);
		return gridpanel;
	}
	
	void initrenderer()
	{
		final com.base.myproject.client.tools.GreetingServiceAsync greetingService = GWT
		.create(com.base.myproject.client.tools.GreetingService.class);
greetingService.getDataSet(
		"select systembcode,bname from systembcode_view ",
		new AsyncCallback<DataSet>() {

			@Override
			public void onFailure(Throwable caught) {
				Info.display("", "失败");
			}

			@Override
			public void onSuccess(final DataSet result) {
				Info.display("", "成功");
				 GridCellRenderer gcr = new GridCellRenderer()
				{

					@Override
					public Object render(ModelData model, String property,
							ColumnData config, int rowIndex, int colIndex,
							ListStore store, Grid grid) {
						// TODO Auto-generated method stub
						for(int i=0;i<result.getRowCount();i++)
						{
							
							
							if(result.getValue(i, "systembcode").equals(model.get(property)))
							{
							return	result.getValue(i, "bname");
							}
						}
						return model.get(property);
					
					}
					
				};
				systembcodecolumn.setRenderer(gcr);
				bcodegrid.getBg().getView().refresh(false);
				systembcodecolumn_lw.setRenderer(gcr);
				lwgrid.getBg().getView().refresh(false);
				
			}

		});
	}

	int sync = 0;
	Listener<BaseEvent> defaultlistener;

	Listener<BaseEvent> getListener() {
		if (defaultlistener != null) {
			return defaultlistener;
		}

		defaultlistener = new Listener<BaseEvent>() {
			public void handleEvent(BaseEvent be) {
				sync++;
				try {
					if (sync == 1) {
						if (be.getType() == Events.Select) {
							if (be.getSource().equals("按钮变量")) {

							}
						} else if (be.getType() == Events.Change) {
							if (be.getSource().equals("输入型变量")) {

							}
						} else if (be.getType() == Events.KeyUp) {
							if (be instanceof ComponentEvent) {
								if (((ComponentEvent) be).getKeyCode() == 13) // 回车
								{
								}
							}
						}
					}
				} finally {
					sync--;
				}
			}

		};
		return defaultlistener;
	}
}
